home *** CD-ROM | disk | FTP | other *** search
- ;Fade Demo
- ;---------
- ;There are three examples of fading in this program: Fade_To_White,
- ;Fade_To_Palette, and Fade_To_Black.
- ;
- ;Press fire to see the end of the fade sequence.
-
- opt o+
-
- INCLUDE "exec/exec_lib.i"
- INCLUDE "games/games_lib.i"
- INCLUDE "games/games.i
- INCLUDE "games/gamesbase.i"
-
- CALL MACRO
- jsr _LVO\1(a6)
- ENDM
-
- LOCAL = 1
-
- SECTION "FadingDemo",CODE
-
- ;===========================================================================;
- ; INITIALISE DEMO
- ;===========================================================================;
-
- Start: MOVEM.L A0-A6/D1-D7,-(SP)
- move.l ($4).w,a6
- lea GMS_Name(pc),a1
- moveq #$00,d0
- CALL OpenLibrary
- move.l d0,GMS_Base
- beq Quit
-
- move.l GMS_Base(pc),a6
- CALL SetUserPri
-
- move.l GMS_Base(pc),a6 ;Tell GMS that we want to add a
- lea ScreenStruct(pc),a0 ;screen for use.
- CALL Add_Screen
- tst.l d0
- bne.s Error
-
- move.l SS_MemPtr1(a0),a1 ;Destination = SS_MemPtr1.
- lea PackedPicFile(pc),a0 ;File Name.
- CALL QuickLoad
- tst.l d0
- beq.s Error
-
- lea ScreenStruct(pc),a0 ;Unpack the data on top of itself.
- move.l SS_MemPtr1(a0),a1
- move.l a1,a0
- moveq #$00,d0
- CALL SmartUnpack
-
- lea ScreenStruct(pc),a0 ;Now show the screen/pic.
- CALL Show_Screen
-
- ;===========================================================================;
- ; MAIN CODE
- ;===========================================================================;
-
- moveq #30,d0
- CALL Wait_Time
-
- .Fade CALL Wait_VBL
- CALL Wait_OSVBL
- moveq #00,d0 ;d0 = Start at colour zero.
- moveq #16,d1 ;d1 = Amount of colours (32)
- lea ScreenPalette(pc),a1
- CALL B12_FadeToPalette
- tst.w d0
- bne.s .Fade
-
- CALL Wait_LMB
-
- Fade_Here: ;This is the fade routine. It will
- .Fade1 CALL Wait_OSVBL ;keep on looping until the fade is
- moveq #00,d0 ;completely finished (ie all
- moveq #16,d1 ;colours are white). Notice the
- CALL B12_FadeToWhite ;start colour is 00 and the amt of
- tst.w d0 ;colours is 32, so that all the cols
- bne.s .Fade1 ;are included in the range.
-
- moveq #30,d0
- CALL Wait_Time
- ;Now we fade down to black. Note
- .Fade2 CALL Wait_OSVBL ;that we have calld Initialise_Fader
- CALL B12_FadeToBlack ;every time - otherwise each fade
- tst.w d0 ;would not even attempt to start!
- bne.s .Fade2 ;Also of interest is that Fading
- ;to Black covers ALL colours.
- moveq #50,d0
- CALL Wait_Time
-
- ;===========================================================================;
- ; RETURN TO DOS
- ;===========================================================================;
-
- CALL Delete_Screen ;Give back screen memory etc.
- Error move.l GMS_Base(pc),a1
- move.l ($4).w,a6
- CALL CloseLibrary
- Quit MOVEM.L (SP)+,A0-A6/D1-D7
- moveq #$00,d0
- rts
-
- ;===========================================================================;
- ; DATA
- ;===========================================================================;
-
- GMS_Name:
- dc.b "games.library",0
- even
- GMS_Base:
- dc.l 0
-
- AMT_PLANES = 4
-
- ScreenStruct:
- dc.l "GSV1"
- dc.l 0,0,0 ;Screen_Mem1/2/3
- dc.l 0 ;Screen link.
- dc.l 0 ;ScreenPalette ;Address of screen palette.
- dc.l 0 ;Address of rasterlist.
- dc.l 16 ;Amt of colours in palette.
- dc.w 256,320,320/8 ;Screen Height, Width, Width/8
- dc.w 256,320,320/8 ;Pic Height, Width, Width/8
- dc.w AMT_PLANES ;Amt_Planes
- dc.w 0,0 ;Top Of Screen, X/Y
- dc.w 0 ;Scroll buffer in pixels/8.
- dc.w 0,0 ;X/Y counters (for scrolling).
- dc.l NOBURST ;Special attributes.
- dc.w LORES ;Screen mode.
- dc.b INTERLEAVED ;Screen type
- dc.b 0 ;Screen Is Being Displayed?
- dc.l 0,0 ;Reserved area.
- even
-
- ScreenPalette:
- dc.w $0000,$0400,$0501,$0501,$0601,$0701,$0701,$0801
- dc.w $0901,$0A01,$0B02,$0432,$0CC0,$0F00,$0211,$0880
-
- ;===========================================================================;
- ; PACKED DATA (OKAY FOR FASTRAM)
- ;===========================================================================;
-
-
- PackedPicFile:
- IFNE LOCAL
- dc.b "GAMESLIB:"
- ENDC
- dc.b "data/Background16.pak",0
- even
-
-